#ifndef _MCU_TIMER_H_
#define _MCU_TIMER_H_

#include "mcu.h"



#define TIM4_TICK_COUNT		(TIM4_CYCLE*1000l*F_MASTER)	//TICK计时需要的时钟周期数
#if (TIM4_TICK_COUNT>32640)
	#error "TIME4 can not support this TIM4_CYCLE."
#elif (TIM4_TICK_COUNT>128)
	#define TIM4_PSCR_VALUE		7	//2^7=128
	#define TIM4_ARR_VALUE		(TIM4_TICK_COUNT/128)
#else
	#error "TIM4_CYCLE is too short."
#endif



void Tim2_Init();

void Tim4_Init();

#define Tim4_GetCycleValue()        TIM4_ARR_VALUE

#define Tim4_GetNowValue()          TIM4_CNTR

#endif
